package com.chai.factory;

import com.chai.service.BookService;
import com.chai.service.impl.BookServiceImpl;
import org.springframework.beans.factory.FactoryBean;
/**
 * 使用FactoryBean创建实例化bean
 * */
public class BookServiceFactoryBean implements FactoryBean<BookService> {
    public BookService getObject() throws Exception {
        return new BookServiceImpl();
    }

    public Class<?> getObjectType() {
        return BookFactory.class;
    }
    //改变创建的Bean对象是否单例。true是单例，false是非单例
    public boolean isSingleton() {
        return true;
    }
}
